package com.anjoyo.xgh.musicshare.activity;

import java.io.UnsupportedEncodingException;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.widget.ImageView;

import com.anjoyo.xgh.musicshare.R;
import com.anjoyo.xgh.musicshare.application.SongApplication;
import com.anjoyo.xgh.musicshare.entry.User;
import com.anjoyo.xgh.musicshare.service.DownloadService;
import com.anjoyo.xgh.musicshare.util.MusicSpf;

public class MainActivity extends Activity {
	Intent intent;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		startService(new Intent(this, DownloadService.class));
		// 判断手否登陆过
		if (MusicSpf.getloginUser(this) != null) {
			intent = new Intent(this, HomeActivity.class);
		}else {
			if (MusicSpf.getisshowedWelcome(this)) {
				intent = new Intent(this, LoginAct.class);
			}else {
				intent =new Intent(this,WelcomeAct.class);
			}
		}
		// 登陆方式
		startActivity(intent);
	}

	@Override
	protected void onStop() {
		super.onStop();
		SongApplication.getInstance().ishaveFavFile();
		SongApplication.getInstance().getPlayer().stop();
	}

}
